package com.common.web.impl;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Component;

import com.common.util.StrUtils;
import com.common.web.ClientRequests;
import com.common.web.ContextPvd;

@Component
public class ContextPvdImpl implements ContextPvd {
	

	/**
	 * 获取网络链接地址 如本地：http://127.0.0.1/[port]/[project]
	 */
	@Override
	public String getNetWorkPath() {
		StringBuilder url=new StringBuilder();
		//获取端口
		Integer prot=ClientRequests.get().getServerPort();
		//获取项目名称
		String  contextPath=ClientRequests.get().getContextPath();
		//获取域名
		String name=ClientRequests.get().getServerName();
		url.append(name).append(":").append(prot).append(contextPath);
		return StrUtils.handelUrl(url.toString());
	}

}
